

import numpy as np
import cv2

img=cv2.imread("images/a.jpg")
#cv2.imshow("img",img)
#        y1:y2,x1:x2
rio =img[0:200,1:200] 
#红色通道置零，浅拷贝//相互影响
#rio[:,:,2]=0
cv2.imshow('rio',rio)
cv2.imshow('rio2',img)
temp=rio.copy()
#红色通道置零，深拷贝（复制）互不影响
temp[:,:,2]=0
cv2.imshow('temp',temp)
cv2.imshow('rio',rio)
#cv2.imshow('temp',temp)
cv2.waitKey(0)